<!DOCTYPE html>
<html lang="zh-CN">





<head>
  <meta charset="UTF-8">
  <link rel="apple-touch-icon" sizes="76x76" href="/michuanblog/img/favicon.png">
  <link rel="icon" type="image/png" href="/michuanblog/img/favicon.png">
  <meta name="viewport"
        content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, shrink-to-fit=no">
  <meta http-equiv="x-ua-compatible" content="ie=edge">
  
  <meta name="theme-color" content="#2f4154">
  <meta name="description" content="Coding">
  <meta name="author" content="胡晗">
  <meta name="keywords" content="">
  <title>lcof_54 - 胡晗&#39;s Blog</title>

  <link  rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.4.1/css/bootstrap.min.css" />


  <link  rel="stylesheet" href="https://cdn.staticfile.org/github-markdown-css/4.0.0/github-markdown.min.css" />
  <link  rel="stylesheet" href="/michuanblog/lib/hint/hint.min.css" />

  
    <link  rel="stylesheet" href="https://cdn.staticfile.org/highlight.js/10.0.0/styles/github-gist.min.css" />
  

  


<!-- 主题依赖的图标库，不要自行修改 -->

<link rel="stylesheet" href="//at.alicdn.com/t/font_1749284_yg9cfy8wd6.css">



<link rel="stylesheet" href="//at.alicdn.com/t/font_1736178_pjno9b9zyxs.css">


<link  rel="stylesheet" href="/michuanblog/css/main.css" />

<!-- 自定义样式保持在最底部 -->


  <script  src="/michuanblog/js/utils.js" ></script>
<meta name="generator" content="Hexo 4.2.1"></head>


<body>
  <header style="height: 70vh;">
    <nav id="navbar" class="navbar fixed-top  navbar-expand-lg navbar-dark scrolling-navbar">
  <div class="container">
    <a class="navbar-brand"
       href="/michuanblog/">&nbsp;<strong>MiChuan</strong>&nbsp;</a>

    <button id="navbar-toggler-btn" class="navbar-toggler" type="button" data-toggle="collapse"
            data-target="#navbarSupportedContent"
            aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <div class="animated-icon"><span></span><span></span><span></span></div>
    </button>

    <!-- Collapsible content -->
    <div class="collapse navbar-collapse" id="navbarSupportedContent">
      <ul class="navbar-nav ml-auto text-center">
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/michuanblog/">
                <i class="iconfont icon-home-fill"></i>
                首页
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/michuanblog/archives/">
                <i class="iconfont icon-archive-fill"></i>
                归档
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/michuanblog/categories/">
                <i class="iconfont icon-category-fill"></i>
                分类
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/michuanblog/tags/">
                <i class="iconfont icon-tags-fill"></i>
                标签
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/michuanblog/about/">
                <i class="iconfont icon-user-fill"></i>
                关于
              </a>
            </li>
          
        
        
          <li class="nav-item" id="search-btn">
            <a class="nav-link" data-toggle="modal" data-target="#modalSearch">&nbsp;&nbsp;<i
                class="iconfont icon-search"></i>&nbsp;&nbsp;</a>
          </li>
        
      </ul>
    </div>
  </div>
</nav>

    <div class="view intro-2" id="background" parallax=true
         style="background: url('/michuanblog/img/default.png') no-repeat center center;
           background-size: cover;">
      <div class="full-bg-img">
        <div class="mask flex-center" style="background-color: rgba(0, 0, 0, 0.3)">
          <div class="container text-center white-text fadeInUp">
            <span class="h2" id="subtitle">
              
            </span>

            
              
  <div class="mt-3 post-meta">
    <i class="iconfont icon-date-fill" aria-hidden="true"></i>
    <time datetime="2020-09-07 14:28">
      2020年9月7日 下午
    </time>
  </div>


<div class="mt-1">
  
    
    <span class="post-meta mr-2">
      <i class="iconfont icon-chart"></i>
      789 字
    </span>
  

  
    
    <span class="post-meta mr-2">
      <i class="iconfont icon-clock-fill"></i>
      
      
      13
       分钟
    </span>
  

  
  
</div>

            
          </div>

          
        </div>
      </div>
    </div>
  </header>

  <main>
    
      

<div class="container-fluid">
  <div class="row">
    <div class="d-none d-lg-block col-lg-2"></div>
    <div class="col-lg-8 nopadding-md">
      <div class="container nopadding-md" id="board-ctn">
        <div class="py-5" id="board">
          <div class="post-content mx-auto" id="post">
            
            <article class="markdown-body">
              <h2 id="LCOF54-二叉搜索树的第k大节点"><a href="#LCOF54-二叉搜索树的第k大节点" class="headerlink" title="LCOF54 二叉搜索树的第k大节点"></a><a href="https://leetcode-cn.com/problems/er-cha-sou-suo-shu-de-di-kda-jie-dian-lcof/" target="_blank" rel="noopener">LCOF54 二叉搜索树的第k大节点</a></h2><h3 id="题目"><a href="#题目" class="headerlink" title="题目"></a>题目</h3><p>给定一棵二叉搜索树，请找出其中第k大的节点。</p>
<h3 id="解析"><a href="#解析" class="headerlink" title="解析"></a>解析</h3><ul>
<li>二叉搜索树，右子树 &gt; 根 &gt; 左子树</li>
<li>逆中序遍历，右-&gt;根-&gt;左</li>
<li>第k大，即逆中序遍历到的第k个节点</li>
<li>利用栈实现非递归逆中序遍历</li>
</ul>
<h3 id="代码"><a href="#代码" class="headerlink" title="代码"></a>代码</h3><pre><code class="hljs C++"><span class="hljs-comment">/**</span>
<span class="hljs-comment"> * Definition for a binary tree node.</span>
<span class="hljs-comment"> * struct TreeNode &#123;</span>
<span class="hljs-comment"> *     int val;</span>
<span class="hljs-comment"> *     TreeNode *left;</span>
<span class="hljs-comment"> *     TreeNode *right;</span>
<span class="hljs-comment"> *     TreeNode(int x) : val(x), left(NULL), right(NULL) &#123;&#125;</span>
<span class="hljs-comment"> * &#125;;</span>
<span class="hljs-comment"> */</span>
<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Solution</span> &#123;</span>
<span class="hljs-keyword">public</span>:
    <span class="hljs-function"><span class="hljs-keyword">int</span> <span class="hljs-title">kthLargest</span><span class="hljs-params">(TreeNode* root, <span class="hljs-keyword">int</span> k)</span> </span>&#123;<span class="hljs-comment">//逆中序遍历</span>
        <span class="hljs-built_in">stack</span>&lt;TreeNode*&gt; nodeStack;
        TreeNode* curNode = root;
        <span class="hljs-keyword">if</span>(root-&gt;left == <span class="hljs-literal">NULL</span> &amp;&amp; root-&gt;right == <span class="hljs-literal">NULL</span> &amp;&amp; k == <span class="hljs-number">1</span>) <span class="hljs-keyword">return</span> root-&gt;val;
        <span class="hljs-keyword">while</span> (curNode != <span class="hljs-literal">NULL</span> || !nodeStack.empty())&#123;
            <span class="hljs-keyword">while</span> (curNode != <span class="hljs-literal">NULL</span>)&#123;
                nodeStack.push(curNode);
                curNode = curNode-&gt;right;<span class="hljs-comment">//右</span>
            &#125;
            TreeNode* top = nodeStack.top();<span class="hljs-comment">//根</span>
            nodeStack.pop();
            <span class="hljs-keyword">if</span>((--k) == <span class="hljs-number">0</span>) &#123;
                curNode = top;
                <span class="hljs-keyword">break</span>;
            &#125;
            curNode = top-&gt;left;<span class="hljs-comment">//左</span>
        &#125;
        <span class="hljs-keyword">return</span> curNode-&gt;val;
    &#125;
&#125;;</code></pre>
<h3 id="扩展"><a href="#扩展" class="headerlink" title="扩展"></a>扩展</h3><p>二叉树非递归遍历</p>
<pre><code class="hljs C++"><span class="hljs-meta">#<span class="hljs-meta-keyword">include</span> <span class="hljs-meta-string">&lt;iostream&gt;</span></span>
<span class="hljs-meta">#<span class="hljs-meta-keyword">include</span> <span class="hljs-meta-string">&lt;string&gt;</span></span>
<span class="hljs-meta">#<span class="hljs-meta-keyword">include</span> <span class="hljs-meta-string">&lt;queue&gt;</span></span>
<span class="hljs-meta">#<span class="hljs-meta-keyword">include</span> <span class="hljs-meta-string">&lt;sstream&gt;</span></span>
<span class="hljs-meta">#<span class="hljs-meta-keyword">include</span> <span class="hljs-meta-string">&lt;stack&gt;</span></span>
<span class="hljs-keyword">using</span> <span class="hljs-keyword">namespace</span> <span class="hljs-built_in">std</span>;

<span class="hljs-class"><span class="hljs-keyword">struct</span> <span class="hljs-title">TreeNode</span> &#123;</span>
      <span class="hljs-keyword">int</span> val;
      TreeNode *left;
      TreeNode *right;
      TreeNode(<span class="hljs-keyword">int</span> x) : val(x), left(<span class="hljs-literal">NULL</span>), right(<span class="hljs-literal">NULL</span>) &#123;&#125;
&#125;;

<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Traverse</span> &#123;</span>
<span class="hljs-keyword">public</span>:
	Traverse()&#123;&#125;
	~Traverse()&#123;&#125;

	<span class="hljs-function"><span class="hljs-keyword">void</span> <span class="hljs-title">preorderTraverse</span><span class="hljs-params">(TreeNode* root)</span> </span>&#123;<span class="hljs-comment">//先序遍历</span>
		<span class="hljs-built_in">std</span>::<span class="hljs-built_in">cout</span>&lt;&lt;<span class="hljs-string">"preorderTraverse:"</span>&lt;&lt;<span class="hljs-built_in">endl</span>;
		<span class="hljs-keyword">if</span> (root == <span class="hljs-literal">NULL</span>) <span class="hljs-keyword">return</span>;
        <span class="hljs-built_in">stack</span>&lt;TreeNode*&gt; nodeStack;
        TreeNode* curNode = root;
        <span class="hljs-keyword">while</span> (curNode != <span class="hljs-literal">NULL</span> || !nodeStack.empty())&#123;
            <span class="hljs-keyword">while</span> (curNode != <span class="hljs-literal">NULL</span>)&#123;
            	<span class="hljs-built_in">std</span>::<span class="hljs-built_in">cout</span> &lt;&lt; curNode-&gt;val &lt;&lt; <span class="hljs-string">" "</span>;
                nodeStack.push(curNode);
                curNode = curNode-&gt;left;
            &#125;
            <span class="hljs-keyword">if</span>(!nodeStack.empty())&#123;
            	curNode = nodeStack.top();
            	nodeStack.pop();
            	curNode = curNode-&gt;right;
            &#125;
        &#125;
        <span class="hljs-built_in">printf</span>(<span class="hljs-string">"\n"</span>);
	&#125;

	<span class="hljs-function"><span class="hljs-keyword">void</span> <span class="hljs-title">inorderTraverse</span><span class="hljs-params">(TreeNode* root)</span> </span>&#123;<span class="hljs-comment">//中序遍历</span>
		<span class="hljs-built_in">std</span>::<span class="hljs-built_in">cout</span>&lt;&lt;<span class="hljs-string">"inorderTraverse:"</span>&lt;&lt;<span class="hljs-built_in">endl</span>;
		<span class="hljs-keyword">if</span> (root == <span class="hljs-literal">NULL</span>) <span class="hljs-keyword">return</span>;
        <span class="hljs-built_in">stack</span>&lt;TreeNode*&gt; nodeStack;
        TreeNode* curNode = root;
        <span class="hljs-keyword">while</span> (curNode != <span class="hljs-literal">NULL</span> || !nodeStack.empty())&#123;
            <span class="hljs-keyword">while</span> (curNode != <span class="hljs-literal">NULL</span>)&#123;
                nodeStack.push(curNode);
                curNode = curNode-&gt;left;
            &#125;
            TreeNode* top = nodeStack.top();
            nodeStack.pop();
            <span class="hljs-built_in">std</span>::<span class="hljs-built_in">cout</span> &lt;&lt; top-&gt;val &lt;&lt; <span class="hljs-string">" "</span>;
            curNode = top-&gt;right;
        &#125;
        <span class="hljs-built_in">printf</span>(<span class="hljs-string">"\n"</span>);
    &#125;

    <span class="hljs-function"><span class="hljs-keyword">void</span> <span class="hljs-title">backorderTraverse</span><span class="hljs-params">(TreeNode* root)</span> </span>&#123;<span class="hljs-comment">//后序遍历</span>
		<span class="hljs-built_in">std</span>::<span class="hljs-built_in">cout</span>&lt;&lt;<span class="hljs-string">"backorderTraverse:"</span>&lt;&lt;<span class="hljs-built_in">endl</span>;
		<span class="hljs-keyword">if</span> (root == <span class="hljs-literal">NULL</span>) <span class="hljs-keyword">return</span>;
        <span class="hljs-built_in">stack</span>&lt;TreeNode*&gt; nodeStack;
        TreeNode* curNode = root;
        TreeNode* refer = <span class="hljs-literal">NULL</span>;
        <span class="hljs-keyword">while</span> (curNode != <span class="hljs-literal">NULL</span> || !nodeStack.empty())&#123;
            <span class="hljs-keyword">if</span>(curNode != <span class="hljs-literal">NULL</span>)&#123;<span class="hljs-comment">//从根节点到最左下角的左子树都入栈</span>
            	nodeStack.push(curNode);<span class="hljs-comment">//中序现将结点进栈保存</span>
            	curNode = curNode-&gt;left;
        	&#125; <span class="hljs-keyword">else</span>&#123;
        		curNode = nodeStack.top();<span class="hljs-comment">//取栈顶</span>
            	<span class="hljs-keyword">if</span>(curNode-&gt;right &amp;&amp; curNode-&gt;right!=refer)&#123;<span class="hljs-comment">//1.右子树还没有访问并且右子树不空，第一次栈顶</span>
                	curNode=curNode-&gt;right;<span class="hljs-comment">///进入右子树</span>
            	&#125;
            	<span class="hljs-keyword">else</span>&#123;<span class="hljs-comment">//右子树已经访问或为空，接下来出栈访问结点，第二次栈顶</span>
            		curNode = nodeStack.top();<span class="hljs-comment">//取栈顶</span>
               		nodeStack.pop();
               		<span class="hljs-built_in">std</span>::<span class="hljs-built_in">cout</span> &lt;&lt; curNode-&gt;val &lt;&lt; <span class="hljs-string">" "</span>;
                	refer = curNode;<span class="hljs-comment">///指向访问过的右子树结点</span>
                	curNode=<span class="hljs-literal">NULL</span>;<span class="hljs-comment">///使p为空继续访问栈顶</span>
            	&#125;
        	&#125;
        &#125;
        <span class="hljs-built_in">printf</span>(<span class="hljs-string">"\n"</span>);
	&#125;

	<span class="hljs-function"><span class="hljs-keyword">void</span> <span class="hljs-title">levelTraverse</span><span class="hljs-params">(TreeNode* root)</span> </span>&#123;<span class="hljs-comment">//层序遍历</span>
		<span class="hljs-built_in">std</span>::<span class="hljs-built_in">cout</span>&lt;&lt;<span class="hljs-string">"levelTraverse:"</span>&lt;&lt;<span class="hljs-built_in">endl</span>;
		<span class="hljs-keyword">if</span> (root == <span class="hljs-literal">NULL</span>) <span class="hljs-keyword">return</span>;
		<span class="hljs-built_in">queue</span>&lt;TreeNode*&gt; treeQueue;
		TreeNode* curNode = root;
		treeQueue.push(root);<span class="hljs-comment">//根节点入队</span>
		<span class="hljs-built_in">std</span>::<span class="hljs-built_in">cout</span> &lt;&lt; root-&gt;val &lt;&lt; <span class="hljs-string">" "</span>;<span class="hljs-comment">//访问根节点</span>
		<span class="hljs-keyword">while</span> (!treeQueue.empty()) &#123;
			curNode = treeQueue.front();<span class="hljs-comment">//队首元素</span>
			<span class="hljs-keyword">if</span> (curNode-&gt;left != <span class="hljs-literal">NULL</span>) &#123;
				<span class="hljs-built_in">std</span>::<span class="hljs-built_in">cout</span> &lt;&lt; curNode-&gt;left-&gt;val &lt;&lt; <span class="hljs-string">" "</span>;
				treeQueue.push(curNode-&gt;left);
			&#125;
			<span class="hljs-keyword">if</span> (curNode-&gt;right != <span class="hljs-literal">NULL</span>) &#123;
				<span class="hljs-built_in">std</span>::<span class="hljs-built_in">cout</span> &lt;&lt; curNode-&gt;right-&gt;val &lt;&lt; <span class="hljs-string">" "</span>;
				treeQueue.push(curNode-&gt;right);
			&#125;
			treeQueue.pop();<span class="hljs-comment">//队首元素出队</span>
		&#125;
		<span class="hljs-built_in">printf</span>(<span class="hljs-string">"\n"</span>);
	&#125;
&#125;;

<span class="hljs-function"><span class="hljs-keyword">int</span> <span class="hljs-title">main</span><span class="hljs-params">()</span> </span>&#123;
	TreeNode* treeRoot = <span class="hljs-keyword">new</span> TreeNode(<span class="hljs-number">1</span>);
	treeRoot-&gt;left = <span class="hljs-keyword">new</span> TreeNode(<span class="hljs-number">2</span>);
	treeRoot-&gt;right = <span class="hljs-keyword">new</span> TreeNode(<span class="hljs-number">3</span>);
	treeRoot-&gt;right-&gt;left = <span class="hljs-keyword">new</span> TreeNode(<span class="hljs-number">4</span>);
	treeRoot-&gt;right-&gt;right = <span class="hljs-keyword">new</span> TreeNode(<span class="hljs-number">5</span>);
	Traverse T;
	T.preorderTraverse(treeRoot);
	T.inorderTraverse(treeRoot);
	T.backorderTraverse(treeRoot);
	T.levelTraverse(treeRoot);
	<span class="hljs-keyword">return</span> <span class="hljs-number">0</span>;
&#125;</code></pre>

            </article>
            <hr>
            <div>
              <div class="post-metas mb-3">
                
                  <div class="post-meta mr-3">
                    <i class="iconfont icon-category"></i>
                    
                      <a class="hover-with-bg" href="/michuanblog/categories/LeetCode-LCOF/">LeetCode_LCOF</a>
                    
                  </div>
                
                
                  <div class="post-meta">
                    <i class="iconfont icon-tags"></i>
                    
                      <a class="hover-with-bg" href="/michuanblog/tags/LeetCode/">LeetCode</a>
                    
                      <a class="hover-with-bg" href="/michuanblog/tags/C/">C++</a>
                    
                      <a class="hover-with-bg" href="/michuanblog/tags/LCOF/">LCOF</a>
                    
                      <a class="hover-with-bg" href="/michuanblog/tags/%E9%A2%98%E8%A7%A3/">题解</a>
                    
                  </div>
                
              </div>
              
                <p class="note note-warning">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-sa/4.0/deed.zh" target="_blank" rel="nofollow noopener noopener">CC BY-SA 4.0 协议</a> ，转载请注明出处！</p>
              
              
                <div class="post-prevnext row">
                  <div class="post-prev col-6">
                    
                    
                      <a href="/michuanblog/2020/09/07/lcof-55-1/">
                        <i class="iconfont icon-arrowleft"></i>
                        <span class="hidden-mobile">lcof_55_1</span>
                        <span class="visible-mobile">上一篇</span>
                      </a>
                    
                  </div>
                  <div class="post-next col-6">
                    
                    
                      <a href="/michuanblog/2020/09/07/lcof-52/">
                        <span class="hidden-mobile">lcof_52</span>
                        <span class="visible-mobile">下一篇</span>
                        <i class="iconfont icon-arrowright"></i>
                      </a>
                    
                  </div>
                </div>
              
            </div>

            
              <!-- Comments -->
              <div class="comments" id="comments">
                
                
  <div id="vcomments"></div>
  <script type="text/javascript">
    function loadValine() {
      addScript('https://cdn.staticfile.org/valine/1.4.14/Valine.min.js', function () {
        new Valine({
          el: "#vcomments",
          app_id: "tKy1BysLG32PuX7L8s0rQi9C-gzGzoHsz",
          app_key: "wlDiPjGWwM0U49QD4CpxH5dz",
          placeholder: "说点什么",
          path: window.location.pathname,
          avatar: "retro",
          meta: ["nick","mail","link"],
          pageSize: "10",
          lang: "zh-CN",
          highlight: false,
          recordIP: false,
          serverURLs: "",
        });
      });
    }
    createObserver(loadValine, 'vcomments');
  </script>
  <noscript>Please enable JavaScript to view the <a href="https://valine.js.org" target="_blank" rel="nofollow noopener noopener">comments
      powered by Valine.</a></noscript>


              </div>
            
          </div>
        </div>
      </div>
    </div>
    
      <div class="d-none d-lg-block col-lg-2 toc-container" id="toc-ctn">
        <div id="toc">
  <p class="toc-header"><i class="iconfont icon-list"></i>&nbsp;目录</p>
  <div id="tocbot"></div>
</div>

      </div>
    
  </div>
</div>

<!-- Custom -->


    
  </main>

  
    <a id="scroll-top-button" href="#" role="button">
      <i class="iconfont icon-arrowup" aria-hidden="true"></i>
    </a>
  

  
    <div class="modal fade" id="modalSearch" tabindex="-1" role="dialog" aria-labelledby="ModalLabel"
     aria-hidden="true">
  <div class="modal-dialog modal-dialog-scrollable modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-header text-center">
        <h4 class="modal-title w-100 font-weight-bold">搜索</h4>
        <button type="button" id="local-search-close" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body mx-3">
        <div class="md-form mb-5">
          <input type="text" id="local-search-input" class="form-control validate">
          <label data-error="x" data-success="v"
                 for="local-search-input">关键词</label>
        </div>
        <div class="list-group" id="local-search-result"></div>
      </div>
    </div>
  </div>
</div>
  

  
    <!-- APlayer 音乐播放器 -->
    <div id="aplayer"></div>
    <script defer src="https://cdn.staticfile.org/aplayer/1.10.1/APlayer.min.js" ></script>
<link  rel="stylesheet" href="https://cdn.staticfile.org/aplayer/1.10.1/APlayer.min.css" />
<script type="text/javascript">
  var oldLoadAp = window.onload;
  window.onload = function () {
    oldLoadAp && oldLoadAp();

    new APlayer({
      container: document.getElementById('aplayer'),
      fixed: true,
      autoplay: 'false' === 'true',
      loop: 'all',
      order: 'random',
      theme: '#b7daff',
      preload: 'none',
      audio: [{"name":"黄杨扁担","artist":"鹿女王","url":"http://mi_chuan.gitee.io/blog/黄杨扁担.mp3","cover":"http://mi_chuan.gitee.io/blog/黄杨扁担.png"},{"name":"隔世信","artist":"以冬","url":"http://mi_chuan.gitee.io/blog/隔世信.mp3","cover":"http://mi_chuan.gitee.io/blog/隔世信.jpg"}]
    });
  }
</script>

  

  

  <footer class="mt-5">
  <div class="text-center py-3">
    <div>
      <a href="https://hexo.io" target="_blank" rel="nofollow noopener"><span>Hexo</span></a>
      <i class="iconfont icon-love"></i>
      <a href="https://github.com/fluid-dev/hexo-theme-fluid" target="_blank" rel="nofollow noopener">
        <span>Fluid</span></a>
    </div>
    

    

    
  </div>
</footer>

<!-- SCRIPTS -->
<script  src="https://cdn.staticfile.org/jquery/3.4.1/jquery.min.js" ></script>
<script  src="https://cdn.staticfile.org/twitter-bootstrap/4.4.1/js/bootstrap.min.js" ></script>
<script  src="/michuanblog/js/debouncer.js" ></script>
<script  src="/michuanblog/js/main.js" ></script>

<!-- Plugins -->


  
    <script  src="/michuanblog/js/lazyload.js" ></script>
  



  <script defer src="https://cdn.staticfile.org/clipboard.js/2.0.6/clipboard.min.js" ></script>
  <script  src="/michuanblog/js/clipboard-use.js" ></script>







  <script  src="https://cdn.staticfile.org/tocbot/4.11.1/tocbot.min.js" ></script>
  <script>
    $(document).ready(function () {
      var boardCtn = $('#board-ctn');
      var boardTop = boardCtn.offset().top;

      tocbot.init({
        tocSelector: '#tocbot',
        contentSelector: 'article.markdown-body',
        headingSelector: 'h1,h2,h3,h4,h5,h6',
        linkClass: 'tocbot-link',
        activeLinkClass: 'tocbot-active-link',
        listClass: 'tocbot-list',
        isCollapsedClass: 'tocbot-is-collapsed',
        collapsibleClass: 'tocbot-is-collapsible',
        collapseDepth: 0,
        scrollSmooth: true,
        headingsOffset: -boardTop
      });
      if ($('.toc-list-item').length > 0) {
        $('#toc').css('visibility', 'visible');
      }
    });
  </script>



  <script  src="https://cdn.staticfile.org/typed.js/2.0.11/typed.min.js" ></script>
  <script>
    var typed = new Typed('#subtitle', {
      strings: [
        '  ',
        "lcof_54&nbsp;",
      ],
      cursorChar: "_",
      typeSpeed: 70,
      loop: false,
    });
    typed.stop();
    $(document).ready(function () {
      $(".typed-cursor").addClass("h2");
      typed.start();
    });
  </script>



  <script  src="https://cdn.staticfile.org/anchor-js/4.2.2/anchor.min.js" ></script>
  <script>
    anchors.options = {
      placement: "right",
      visible: "hover",
      
    };
    var el = "h1,h2,h3,h4,h5,h6".split(",");
    var res = [];
    for (item of el) {
      res.push(".markdown-body > " + item)
    }
    anchors.add(res.join(", "))
  </script>



  <script  src="/michuanblog/js/local-search.js" ></script>
  <script>
    var path = "/michuanblog/local-search.xml";
    var inputArea = document.querySelector("#local-search-input");
    inputArea.onclick = function () {
      searchFunc(path, 'local-search-input', 'local-search-result');
      this.onclick = null
    }
  </script>



  <script  src="https://cdn.staticfile.org/fancybox/3.5.7/jquery.fancybox.min.js" ></script>
  <link  rel="stylesheet" href="https://cdn.staticfile.org/fancybox/3.5.7/jquery.fancybox.min.css" />

  <script>
    $('#post img:not(.no-zoom img, img[no-zoom]), img[zoom]').each(
      function () {
        var element = document.createElement('a');
        $(element).attr('data-fancybox', 'images');
        $(element).attr('href', $(this).attr('src'));
        $(this).wrap(element);
      }
    );
  </script>





  

  
    <!-- MathJax -->
    <script>
      MathJax = {
        tex: {
          inlineMath: [['$', '$'], ['\\(', '\\)']]
        },
        options: {
          renderActions: {
            findScript: [10, doc => {
              document.querySelectorAll('script[type^="math/tex"]').forEach(node => {
                const display = !!node.type.match(/; *mode=display/);
                const math = new doc.options.MathItem(node.textContent, doc.inputJax[0], display);
                const text = document.createTextNode('');
                node.parentNode.replaceChild(text, node);
                math.start = { node: text, delim: '', n: 0 };
                math.end = { node: text, delim: '', n: 0 };
                doc.math.push(math);
              });
            }, '', false],
            insertedScript: [200, () => {
              document.querySelectorAll('mjx-container').forEach(node => {
                let target = node.parentNode;
                if (target.nodeName.toLowerCase() === 'li') {
                  target.parentNode.classList.add('has-jax');
                }
              });
            }, '', false]
          }
        }
      };
    </script>

    <script async src="https://cdn.staticfile.org/mathjax/3.0.5/es5/tex-svg.js" ></script>

  



  
  
    <script>
      !function (e, t, a) {
        function r() {
          for (var e = 0; e < s.length; e++) s[e].alpha <= 0 ? (t.body.removeChild(s[e].el), s.splice(e, 1)) : (s[e].y--, s[e].scale += .004, s[e].alpha -= .013, s[e].el.style.cssText = "left:" + s[e].x + "px;top:" + s[e].y + "px;opacity:" + s[e].alpha + ";transform:scale(" + s[e].scale + "," + s[e].scale + ") rotate(45deg);background:" + s[e].color + ";z-index:99999");
          requestAnimationFrame(r)
        }

        function n() {
          var t = "function" == typeof e.onclick && e.onclick;
          e.onclick = function (e) {
            t && t(), o(e)
          }
        }

        function o(e) {
          var a = t.createElement("div");
          a.className = "heart", s.push({
            el: a,
            x: e.clientX - 5,
            y: e.clientY - 5,
            scale: 1,
            alpha: 1,
            color: c()
          }), t.body.appendChild(a)
        }

        function i(e) {
          var a = t.createElement("style");
          a.type = "text/css";
          try {
            a.appendChild(t.createTextNode(e))
          } catch (t) {
            a.styleSheet.cssText = e
          }
          t.getElementsByTagName("head")[0].appendChild(a)
        }

        function c() {
          return "rgb(" + ~~(255 * Math.random()) + "," + ~~(255 * Math.random()) + "," + ~~(255 * Math.random()) + ")"
        }

        var s = [];
        e.requestAnimationFrame = e.requestAnimationFrame || e.webkitRequestAnimationFrame || e.mozRequestAnimationFrame || e.oRequestAnimationFrame || e.msRequestAnimationFrame || function (e) {
          setTimeout(e, 1e3 / 60)
        }, i(".heart{width: 10px;height: 10px;position: fixed;background: #f00;transform: rotate(45deg);-webkit-transform: rotate(45deg);-moz-transform: rotate(45deg);}.heart:after,.heart:before{content: '';width: inherit;height: inherit;background: inherit;border-radius: 50%;-webkit-border-radius: 50%;-moz-border-radius: 50%;position: fixed;}.heart:after{top: -5px;}.heart:before{left: -5px;}"), n(), r()
      }(window, document);
    </script>
  








  <script  src="https://cdn.staticfile.org/mermaid/8.5.0/mermaid.min.js" ></script>
  <script>
    if (window.mermaid) {
      mermaid.initialize({"theme":"default"});
    }
  </script>







<script src="/michuanblog/live2dw/lib/L2Dwidget.min.js?094cbace49a39548bed64abff5988b05"></script><script>L2Dwidget.init({"log":false,"pluginJsPath":"lib/","pluginModelPath":"assets/","pluginRootPath":"live2dw/","tagMode":false});</script></body>
</html>
